package org.automated.realestatemanager.db.services;

import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;

import org.apache.log4j.Logger;
import org.automated.realestatemanager.db.entity.Advertisement;
import org.automated.realestatemanager.db.entity.Publisher;

public class AdvertisementService extends CommonService<Advertisement> {

	private final Logger log = Logger.getLogger(AdvertisementService.class);

	public AdvertisementService() {
		super(Advertisement.class);
	}

	public SortedSet<Advertisement> getAdvSetByPublisher(Publisher publisher) {
		Advertisement adv = new Advertisement();
		adv.setPublisher(publisher);
		List<Advertisement> advs = getList(adv);
		SortedSet<Advertisement> result = new TreeSet<Advertisement>();
		for (Advertisement advt : advs) {
			result.add(advt);
		}
		return result;
	}

}
